<?php
/**
 * Created by PhpStorm.
 * User: 69568
 * Date: 2018/2/7
 * Time: 10:38
 */

namespace App;


trait ApiResponse
{
    /** api返回结果
     * @param string $message
     * @param array $data
     * @param int $code
     * @return \Illuminate\Http\JsonResponse
     */
    public function message(string $message, $data = [], $code = 200)
    {
        return response()->json(['msg' => $message, 'data' => $data], $code);
    }
}